package com.ruoyi.yanjing.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yanjing.mapper.WeatherForecastMapper;
import com.ruoyi.yanjing.domain.WeatherForecast;
import com.ruoyi.yanjing.service.IWeatherForecastService;

/**
 * 预报天气Service业务层处理
 * 
 * @author whz
 * @date 2024-12-04
 */
@Service
public class WeatherForecastServiceImpl implements IWeatherForecastService 
{
    @Autowired
    private WeatherForecastMapper weatherForecastMapper;

    /**
     * 查询预报天气
     * 
     * @param id 预报天气主键
     * @return 预报天气
     */
    @Override
    public WeatherForecast selectWeatherForecastById(Long id)
    {
        return weatherForecastMapper.selectWeatherForecastById(id);
    }

    /**
     * 查询预报天气列表
     * 
     * @param weatherForecast 预报天气
     * @return 预报天气
     */
    @Override
    public List<WeatherForecast> selectWeatherForecastList(WeatherForecast weatherForecast)
    {
        return weatherForecastMapper.selectWeatherForecastList(weatherForecast);
    }

    /**
     * 新增预报天气
     * 
     * @param weatherForecast 预报天气
     * @return 结果
     */
    @Override
    public int insertWeatherForecast(WeatherForecast weatherForecast)
    {
        weatherForecast.setCreateTime(DateUtils.getNowDate());
        return weatherForecastMapper.insertWeatherForecast(weatherForecast);
    }

    /**
     * 修改预报天气
     * 
     * @param weatherForecast 预报天气
     * @return 结果
     */
    @Override
    public int updateWeatherForecast(WeatherForecast weatherForecast)
    {
        weatherForecast.setUpdateTime(DateUtils.getNowDate());
        return weatherForecastMapper.updateWeatherForecast(weatherForecast);
    }

    /**
     * 批量删除预报天气
     * 
     * @param ids 需要删除的预报天气主键
     * @return 结果
     */
    @Override
    public int deleteWeatherForecastByIds(Long[] ids)
    {
        return weatherForecastMapper.deleteWeatherForecastByIds(ids);
    }

    /**
     * 删除预报天气信息
     * 
     * @param id 预报天气主键
     * @return 结果
     */
    @Override
    public int deleteWeatherForecastById(Long id)
    {
        return weatherForecastMapper.deleteWeatherForecastById(id);
    }
}
